export function convertMenusToRoutes(menus) {
  const routes = []

  menus.forEach(menu => {
    if (menu.children?.length) {
      menu.children.forEach(child => {
        routes.push({
          path: child.path,
          name: child.name,
          component: () => import(`@/views${child.path.replace('/app', '')}/index.vue`)
        })
      })
    } else if (menu.path) {
      routes.push({
        path: menu.path,
        name: menu.name,
        component: () => import(`@/views${menu.path.replace('/app', '')}/index.vue`)
      })
    }
  })